package com.yanggu.scala.chapater13.highorderfunction

//高阶函数
object HighOrderFunctionDemo01 {

  def main(args: Array[String]): Unit = {
    //能够接受函数作为参数的函数, 被称之为高阶函数
    def test(f: Double => Double, f2: Double => Double, n1: Double) = {
      f(f2(n1))
    }

    def sum(d: Double) = d + d

    def mod(d: Double) = d.toInt % 2

    println(test(sum, mod, 5.0))
  }

}
